#ifndef K_TASK_PROGRESS_H
#define K_TASK_PROGRESS_H
#pragma once

#include <ShObjIdl.h>
#include <KNoCopy.h>

class KTaskProgress : KNoCopy {
public:
    explicit KTaskProgress(HWND hWnd = NULL, ULONGLONG maxProgress = 100);
    ~KTaskProgress();
public:
    HWND        attach(HWND hWnd = NULL);
    HWND        detach()                        { return attach(); }
    bool        isValid() const                 { return taskBarList != NULL; }
public:
    TBPFLAG     currentStatus() const           { return status; }
    void        setStatus(TBPFLAG newStatus);
    ULONGLONG   currentProgress() const         { return uCur; }
    void        setProgress(ULONGLONG newProgress);
    ULONGLONG   maxProgress() const             { return uMax; }
    void        setMaxProgress(ULONGLONG newMax, bool update = false);
private:
    static bool isWin7();
private:
    HWND            hWindow;
    ITaskbarList3 * taskBarList;
    TBPFLAG         status;
    ULONGLONG       uCur, uMax;
};

#endif // K_TASK_PROGRESS_H